
addCommandHandler("gang",function (plr,cmd,...)
    if not getElementData(plr,"player:uid") then return end
    if not getElementData(plr,"player:gang") then return end
    local result=exports["cmta-db"]:dbGet("SELECT * FROM cmta_gang_members WHERE gang_name=? AND uid=? LIMIT 1;", getElementData(plr,"player:gang"), getElementData(plr,"player:uid"))
    if result and #result > 0 then
    local result2=exports["cmta-db"]:dbGet("SELECT * FROM cmta_gangs WHERE name=? LIMIT 1;", result[1]["gang_name"])
    local result3=exports["cmta-db"]:dbGet("SELECT * FROM cmta_gang_members WHERE gang_name=?", result[1]["gang_name"])
    triggerClientEvent(plr, "cmta_gangs:showGUI", resourceRoot,result3,result2)
    end
end)

addEvent("cmta_gangs:refreshulep", true)
addEventHandler("cmta_gangs:refreshulep", resourceRoot, function()
	local result=exports["cmta-db"]:dbGet("SELECT * FROM cmta_gangs WHERE name=? LIMIT 1;", getElementData(client,"player:gang"))
    triggerClientEvent(client, "cmta_gangs:refresh", resourceRoot, result)
end)
